//
//  ActCell.m
//  MyProject
//
//  Created by dllo on 15/11/6.
//  Copyright (c) 2015年 蓝鸥0825. All rights reserved.
//

#import "ActCell.h"
#import "UIImageView+WebCache.h"

#define WIDTH self.frame.size.width
#define HEIGHT self.frame.size.height


@implementation ActCell

- (void)awakeFromNib {

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    return self;
    
}


- (void)create{
    
    self.image = [[UIImageView alloc] init];
    [self addSubview:self.image];
    [self.image release];
    
    self.imagePhoto = [[UIImageView alloc] init];
    [self addSubview:self.imagePhoto];
    [self.imagePhoto release];
    
    self.labelDetail = [[UILabel alloc] init];
    [self addSubview:self.labelDetail];
    [self.labelDetail release];
    
    self.labelProduce = [[UILabel alloc] init];
    [self addSubview:self.labelProduce];
    [self.labelProduce release];
    
    self.labelActivity = [[UILabel alloc] init];
    [self addSubview:self.labelActivity];
    [self.labelActivity release];
    
    
}

- (void)layoutSubviews{
 
    self.image.frame = CGRectMake(0, 0, WIDTH, HEIGHT / 100 * 60);
    self.labelProduce.frame =CGRectMake(0, HEIGHT / 100 * 60, WIDTH, HEIGHT / 100 * 30);
    self.labelProduce.numberOfLines = 0;
    self.labelProduce.font = [UIFont systemFontOfSize:15];
    
    self.imagePhoto.frame = CGRectMake(WIDTH / 100 * 2, HEIGHT / 100 * 91, WIDTH / 100 * 11, HEIGHT / 100 * 6);
    self.labelDetail.frame = CGRectMake(WIDTH / 100 * 15, HEIGHT / 100 * 90, WIDTH / 100 * 25, HEIGHT / 100 * 8 );
    self.labelActivity.frame = CGRectMake(WIDTH / 100 * 40,  HEIGHT / 100 * 90, WIDTH / 100 * 60, HEIGHT / 100 * 8);
    
    self.labelDetail.font = [UIFont systemFontOfSize:15];
    self.labelActivity.font = [UIFont systemFontOfSize:15];
    self.labelDetail.textColor = [UIColor redColor];
    self.labelActivity.textColor = [UIColor redColor];
    self.labelActivity.textAlignment = 2;
    
}




- (void)setModelAct:(ActivityModel *)modelAct{
    
    if (_modelAct != modelAct) {
        [_modelAct release];
        _modelAct = modelAct;
    }
    [self.image sd_setImageWithURL:self.modelAct.img[@"small"]];
        self.labelProduce.text = [NSString stringWithFormat: @"%@", self.modelAct.smalltext];
        self.labelDetail.text = [NSString stringWithFormat:@"%@个作品", self.modelAct.post_num];
        self.labelActivity.text = self.modelAct.end_date;
        self.imagePhoto.image = [UIImage imageNamed:@"activity.png"];
    
    
}



@end









